home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / hideac1r / search.frm next >
Text File  |  1999-08-18  |  6KB  |  196 lines

  1. VERSION 5.00
  2. Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.DLL"
  3. Begin VB.Form frmSearch 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Search..."
  6.    ClientHeight    =   5775
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   7800
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   5775
  14.    ScaleWidth      =   7800
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.ComboBox cmbEngine 
  18.       Height          =   315
  19.       Left            =   240
  20.       Style           =   2  'Dropdown List
  21.       TabIndex        =   6
  22.       Top             =   5280
  23.       Width           =   2775
  24.    End
  25.    Begin VB.CommandButton Command4 
  26.       Caption         =   "Stop Search"
  27.       Height          =   375
  28.       Left            =   6480
  29.       TabIndex        =   5
  30.       Top             =   120
  31.       Width           =   1215
  32.    End
  33.    Begin VB.CommandButton Command2 
  34.       Caption         =   "Exit"
  35.       Height          =   375
  36.       Left            =   6240
  37.       TabIndex        =   4
  38.       Top             =   5250
  39.       Width           =   1335
  40.    End
  41.    Begin VB.Frame Frame1 
  42.       Caption         =   "Web Browser"
  43.       Height          =   4335
  44.       Left            =   120
  45.       TabIndex        =   2
  46.       Top             =   600
  47.       Width           =   7575
  48.       Begin SHDocVwCtl.WebBrowser WebBrowser1 
  49.          Height          =   3735
  50.          Left            =   240
  51.          TabIndex        =   3
  52.          Top             =   360
  53.          Width           =   7095
  54.          ExtentX         =   12515
  55.          ExtentY         =   6588
  56.          ViewMode        =   1
  57.          Offline         =   0
  58.          Silent          =   0
  59.          RegisterAsBrowser=   0
  60.          RegisterAsDropTarget=   1
  61.          AutoArrange     =   -1  'True
  62.          NoClientEdge    =   0   'False
  63.          AlignLeft       =   0   'False
  64.          ViewID          =   "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
  65.          Location        =   "about:NavigationCanceled"
  66.       End
  67.    End
  68.    Begin VB.TextBox Text1 
  69.       Height          =   285
  70.       Left            =   1920
  71.       TabIndex        =   1
  72.       Top             =   165
  73.       Width           =   4335
  74.    End
  75.    Begin VB.CommandButton Command1 
  76.       Caption         =   "Search..."
  77.       Height          =   375
  78.       Left            =   120
  79.       TabIndex        =   0
  80.       Top             =   120
  81.       Width           =   1575
  82.    End
  83.    Begin VB.Label Label1 
  84.       Caption         =   "Search Engines"
  85.       Height          =   255
  86.       Left            =   240
  87.       TabIndex        =   7
  88.       Top             =   5040
  89.       Width           =   1815
  90.    End
  91. End
  92. Attribute VB_Name = "frmSearch"
  93. Attribute VB_GlobalNameSpace = False
  94. Attribute VB_Creatable = False
  95. Attribute VB_PredeclaredId = True
  96. Attribute VB_Exposed = False
  97. Option Explicit
  98.  
  99. Private Const WEBCRAWLER = "WebCrawler"
  100. Private Const ALTAVISTA = "AltaVista"
  101. Private Const YAHOOCOM = "Yahoo.com"
  102. Private Const YAHOOCOUK = "Yahoo.co.uk"
  103. Private Const HOTBOT = "HotBot"
  104.  
  105. Private Sub cmbEngine_Click()
  106.  
  107.     'Change some bits and pieces on the form to let the user know where they are browsing...
  108.     With Me
  109.         Select Case .cmbEngine.Text
  110.             Case "AltaVista"
  111.                 .Command1.Caption = "Search Altavista"
  112.                 .Frame1.Caption = "Browse AltaVista"
  113.             Case "HotBot"
  114.                 .Command1.Caption = "Search HotBot"
  115.                 .Frame1.Caption = "Browse HotBot"
  116.             Case "Yahoo.com"
  117.                 .Command1.Caption = "Search Yahoo"
  118.                 .Frame1.Caption = "Browse Yahoo"
  119.             Case "Yahoo.co.uk"
  120.                 .Command1.Caption = "Search Yahoo UK"
  121.                 .Frame1.Caption = "Browse Yahoo UK"
  122.             Case "WebCrawler"
  123.                 .Command1.Caption = "Search WebCrawler"
  124.                 .Frame1.Caption = "Browse WebCrawler"
  125.             Case Else
  126.                 MsgBox "Error detected in selecting search Engine"
  127.         End Select
  128.     End With
  129.  
  130. End Sub
  131.  
  132. Private Sub Command1_Click()
  133.     Dim searchURL As String
  134.  
  135.     With Me
  136.         'Check for empty search string
  137.         If .Text1.Text = "" Then
  138.             MsgBox "Please select a keyword(s) to search for"
  139.             Exit Sub
  140.         End If
  141.         'Check for no search engine selected
  142.         If .cmbEngine.Text = "" Then
  143.             MsgBox "Please select your preferred Search Engine"
  144.             Exit Sub
  145.         End If
  146.                 
  147.         Select Case .cmbEngine.Text
  148.             Case "AltaVista"
  149.                 searchURL = "http://www.altavista.com/cgi-bin/query?q=" & .Text1.Text
  150.             Case "HotBot"
  151.                 searchURL = "http://www.hotbot.com/?MT=" & .Text1.Text
  152.             Case "Yahoo.com"
  153.                 searchURL = "http://search.yahoo.com/bin/search?p=" & Text1.Text
  154.             Case "Yahoo.co.uk"
  155.                 searchURL = "http://search.yahoo.co.uk/search/ukie?p=" & .Text1.Text
  156.             Case "WebCrawler"
  157.                 searchURL = "http://www.webcrawler.com/cgi-bin/WebQuery?searchText=" & .Text1.Text
  158.             Case Else
  159.                 MsgBox "Error detected in selecting search Engine"
  160.         End Select
  161.     End With
  162.     
  163.     'Navigate to the selected search engine and keyword
  164.     WebBrowser1.Navigate searchURL
  165.     
  166. End Sub
  167.  
  168. Private Sub Command2_Click()
  169.     Unload Me
  170. End Sub
  171.  
  172. Private Sub Command4_Click()
  173.     WebBrowser1.Stop
  174. End Sub
  175.  
  176. Private Sub Form_Load()
  177.     Dim sURL As String
  178.     
  179.     With Me
  180.         'Assign a default URL to the WebBrowser control or it errors
  181.         sURL = "http://www.yahoo.com"
  182.         .WebBrowser1.Navigate sURL
  183.         'Add items to search engine dropdown box
  184.         .cmbEngine.AddItem ALTAVISTA
  185.         .cmbEngine.AddItem HOTBOT
  186.         .cmbEngine.AddItem WEBCRAWLER
  187.         .cmbEngine.AddItem YAHOOCOM
  188.         .cmbEngine.AddItem YAHOOCOUK
  189.         'Reset form captions
  190.         .Command1.Caption = "Search"
  191.         .Frame1.Caption = "Browse"
  192.     End With
  193.         
  194. End Sub
  195.  
  196.